using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Animator
{
    public class Text
    {
        private float size = 1f;
        private Color color = Color.White;
        SpriteFont font;
        SpriteBatch batch;

        public Text(SpriteBatch batch, SpriteFont font)
        {
            this.font = font;
            this.batch = batch;
        }

        public Color Color
        {
            get { return color; }
            set { color = value; }
        }
        public float Size
        {
            get { return size; }
            set { size = value; }
        }

        public void DrawText(int x, int y, String s)
        {
            //batch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
            batch.Begin();
            batch.DrawString(font, s, new Vector2((float)x, (float)y), color, 0f, Vector2.Zero, size, SpriteEffects.None, 1f);
            batch.End();
        }

        public bool DrawClickText(int x, int y, String s, int mosX, int mosY, bool mouseClick)
        {
            color = Color.White;

            bool r = false;

            if (mosX > x && mosY > y && mosX < x + font.MeasureString(s).X * size && mosY < y + font.MeasureString(s).Y * size)
            {
                color = Color.Yellow;
                r = (mouseClick);
            }

            DrawText(x, y, s);

            return r;
        }
    }
}
